<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%--<script type="text/javascript" src="/res/ueditor/ueditor.config.js"></script>--%>
<%--<!-- 编辑器源码文件 -->--%>
<%--<script type="text/javascript" src="/res/ueditor/ueditor.all.js"></script>--%>



<%@include file="/common/head.jsp" %>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
		<form action="${ctx }/admin/news/save?id=${n.id }" id="detail-form" class="form-horizontal" method="post">

			<div class="form-group">
				 <!-- 部门名 -->
                 <%--<label class="col-sm-2 control-label">部门名</label>--%>
                 <%--<div class="col-sm-4">--%>
                 	<%--<input type="text" class="form-control" name="name" value="${n.name }">--%>
                 <%--</div>--%>

				 <!-- 编号 -->
                 <label class="col-sm-2 control-label">编号</label>
                 <div class="col-sm-4">
                 	<input type="text" class="form-control" name="serialNum" value="${n.serialNum }">
                 </div>
                <!-- 状态，1-未上架，2-已上架，3-已下架 -->
                <label class="col-sm-2 control-label">状态</label>
                <div class="col-sm-4">
                    ${enum:detail('NewsStatus', 'status', n.status)}
                </div>
            </div>

            <div class="form-group">

				 <!-- 标题 -->
                 <label class="col-sm-2 control-label">标题</label>
                 <div class="col-sm-4">
                 	<input type="text" class="form-control" name="title" value="${n.title }">
                 </div>
                <!-- 概要 -->
                <label class="col-sm-2 control-label">概要</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control" name="summary" value="${n.summary }">
                </div>
            </div>
            <div class="form-group">
				 <!-- 缩略图 -->
                 <%--<label class="col-sm-2 control-label">缩略图</label>--%>
                 <%--<div class="col-sm-4">--%>
                 	<%--<input type="text" class="form-control" name="thumb" value="${n.thumb }">--%>
                 <%--</div>--%>
                <!-- 新闻文本内容 -->
                <%--<label class="col-sm-2 control-label">新闻文本内容</label>--%>
                <%--<div class="col-sm-4">--%>
                    <%--<input type="text" class="form-control" name="content" value="${n.content }">--%>
                <%--</div>--%>
            </div>

            <div class="form-group">
                <!-- creator -->
                <%--<label class="col-sm-2 control-label">创建人</label>--%>
                <div class="col-sm-4">
                    <input type="hidden" id="creator-id" name="creator.id" value="${n.creator.id }" class="form-control">
                    <input type="hidden" disabled="disabled" placeholder="请选择creator" class="form-control" id="creator-name" value="${n.creator.id }"
                           onclick="bring({
                                   url:'${ctx}/admin/user/search',
                                   name: 'id',
                                   idInput: 'creator-id',
                                   nameInput: 'creator-name'
                                   })" />

                </div>
                <!-- createTime -->
                <%--<label class="col-sm-2 control-label">创建时间</label>--%>
                <div class="col-sm-4">
                    <input type="hidden" class="form-control" disabled="disabled" name="createTime" value="<fmt:formatDate value='${n.createTime }' pattern='yyyy-MM-dd'/>" onclick="laydate({format: ''})">
                </div>
            </div>
            <div class="form-group">



                <!-- updator -->
                <%--<label class="col-sm-2 control-label">修改人</label>--%>
                <div class="col-sm-4">
                    <input type="hidden" id="updator-id" name="updator.id" value="${n.updator.id }" class="form-control">
                    <input type="hidden" disabled="disabled" placeholder="请选择updator" class="form-control" id="updator-name" value="${n.updator.id }"
                           onclick="bring({
                                   url:'${ctx}/admin/user/search',
                                   name: 'id',
                                   idInput: 'updator-id',
                                   nameInput: 'updator-name'
                                   })" />
                </div>
                <!-- updateTime -->
                <%--<label class="col-sm-2 control-label">修改时间</label>--%>
                <div class="col-sm-4">
                    <input type="hidden" class="form-control" disabled="disabled" name="updateTime" value="<fmt:formatDate value='${n.updateTime }' pattern='yyyy-MM-dd'/>" onclick="laydate({format: ''})">
                </div>
            </div>


    <!-- 新闻文本内容 -->
  <div id="content1" align="center" >
          ${n.content }
  </div>
            <a class="btn btn-primary alter" >编辑新闻</a>
            <script>
                $(function(){
                    $('.alter').click(function(){
                        document.getElementById("divnews").style.display="";
                        document.getElementById("content1").style.display="none";

                    });
                })
            </script>
            <div id="divnews" style="display:none" >
                <script type="text/javascript" charset="utf-8" src=" /res/ueditor/config.js"></script>
                <script type="text/javascript" charset="utf-8" src="/res/ueditor/all.js"> </script>
                <script type="text/javascript" charset="utf-8" src=" /res/ueditor/lang/zh-cn/zh-cn.js"></script>
                <script type="text/javascript">

                    //实例化编辑器
                    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，
                    //直接调用UE.getEditor('editor')就能拿到相关的实例
                    // var ue = UE.getEditor('container');
                    var  ue = new UE.ui.Editor({initialFrameHeight:500 });
                    ue.render("container");
                </script>
                <script id="container" name="content" type="text/plain">
            ${n.content }
          </script>



      </div>

		</form>
</div>

<%@include file="/common/foot.jsp" %>

</body>
</html>
